<?php

namespace app\admin\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use \Exception;
use app\common\lib\Redis as lib_redis;
class Redis extends Command
{
    protected function configure()
    {
        $this->setName('redis')->setDescription('redis队列');
    }

    protected function execute(Input $input, Output $output)
    {
        $output->writeln("开始队列任务," . date("Y-m-d H:i:s"));
        while(true){
            try {

                lib_redis::pop('msg');
                lib_redis::pop('log');
                sleep(sleep(3));
            }catch (\Exception $e){
                $output->writeln("中断队列任务," . date("Y-m-d H:i:s") . ",原因：：" . $e->getMessage());
            }

        }
        $output->writeln("完成队列任务," . date("Y-m-d H:i:s"));
    }
}
